package dietmar.tablice;

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JCheckBox;
import javax.swing.JButton;

import dietmar.turniej.GuiZawodnik;

public class SixpackGUI extends JFrame {

	Sixpack sixpack=new Sixpack();
	private JPanel contentPane;
	JCheckBox Piwko= new JCheckBox();
	JCheckBox Piwko1 = new JCheckBox();
	JCheckBox Piwko2 = new JCheckBox();
	JCheckBox Piwko3 = new JCheckBox();
	JCheckBox Piwko4 = new JCheckBox();
	JCheckBox Piwko5 = new JCheckBox();

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
	
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					SixpackGUI frame = new SixpackGUI();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */

	public SixpackGUI() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 157, 166);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
	
		Piwko.setSelected(true);
		Piwko.setEnabled(false);
		Piwko.setBounds(37, 36, 21, 23);
		contentPane.add(Piwko);
		
		
		Piwko1.setSelected(true);
		Piwko1.setEnabled(false);
		Piwko1.setBounds(58, 36, 21, 23);
		contentPane.add(Piwko1);
		
	
		Piwko2.setSelected(true);
		Piwko2.setEnabled(false);
		Piwko2.setBounds(81, 36, 21, 23);
		contentPane.add(Piwko2);
		
		
		Piwko3.setSelected(true);
		Piwko3.setEnabled(false);
		Piwko3.setBounds(37, 55, 21, 23);
		contentPane.add(Piwko3);
		
		
		Piwko4.setSelected(true);
		Piwko4.setEnabled(false);
		Piwko4.setBounds(60, 55, 21, 23);
		contentPane.add(Piwko4);
		
		
		Piwko5.setSelected(true);
		Piwko5.setEnabled(false);
		Piwko5.setBounds(81, 55, 21, 23);
		contentPane.add(Piwko5);
		
		JButton WezPiwo = new JButton("Wez Piwo");

		WezPiwo.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
			}
		});
		WezPiwo.setBounds(22, 95, 105, 23);
		contentPane.add(WezPiwo);
		
		WezPiwo.addActionListener(new ActionListener()
		{public void actionPerformed(ActionEvent e)
		{
		
	
		if(sixpack.stan()==6)
		{
			Piwko.setSelected(false);
		}
		else if(sixpack.stan()==5)
		{
		Piwko1.setSelected(false);
		}
		else if(sixpack.stan()==4)
		{
			Piwko2.setSelected(false);
		}
		else if(sixpack.stan()==3)
		{
			Piwko3.setSelected(false);
		}
		else if(sixpack.stan()==2)
		{
			Piwko4.setSelected(false);
		}
		else if(sixpack.stan()==1)
		{
			Piwko5.setSelected(false);
			
		}
		else if(sixpack.stan()==0)
		{
			Brak okno=new Brak();
			okno.setVisible(true);
		}
		sixpack.wezPiwo();
			

        }});
	}
}
